package cn.chrilwe.pigpig.im.rabbit.test;

import cn.chrilwe.pigpig.im.model.RabbitModel;
import cn.chrilwe.pigpig.im.rabbit.common.RabbitConfiguration;
import cn.chrilwe.pigpig.im.rabbit.factory.RabbitSession;
import cn.chrilwe.pigpig.im.rabbit.factory.RabbitSessionFactory;
import cn.chrilwe.pigpig.im.rabbit.factory.impl.RabbitSessionFactoryBean;

public class RabbitProducer {

	public static void main(String[] args) {
		RabbitConfiguration config = new RabbitConfiguration();
		config.setConnectionTimeout(1000);
		config.setHost("192.168.43.163");
		config.setPort(5672);
		config.setUsername("guest");
		config.setPassword("guest");
		config.setVirtual_host("/");
		RabbitSessionFactoryBean b = new RabbitSessionFactoryBean(config);
		RabbitSessionFactory factory = b.getFactory();
		RabbitSession session = factory.openSession();
		RabbitModel m = new RabbitModel();
		m.setAutoAck(true);
		m.setAutoDelete(false);
		m.setCurrentConnectPrivate(false);
		m.setExchange("test");
		m.setMap(null);
		m.setPersistence(true);
		m.setQueue("testQueue");
		m.setRoutingKey("testKey");
		session.send("hello", m);
	}

}
